feat: add CreateRelease tool for GitHub releases#1015
Open
zzstoatzz wants to merge 3 commits intogithub:mainfrom
Open
feat: add CreateRelease tool for GitHub releases#1015zzstoatzz wants to merge 3 commits intogithub:mainfrom
zzstoatzz wants to merge 3 commits intogithub:mainfrom
Conversation
Implements a new CreateRelease tool following the existing pattern used by CreateRepository and other create operations. Features: - Creates GitHub releases with tag name, target commitish, and release notes - Supports draft and prerelease flags - Supports automatic release notes generation - Comprehensive test coverage following existing test patterns Closes github#1012
Addresses Copilot review comment - the response body was being closed before attempting to read it in the error case. Now we only close it after reading when needed.
Put single defer statement right after successful API call to ensure body is closed in all paths. Removes duplicate defer statements.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new CreateRelease tool to the GitHub MCP server, enabling programmatic creation of GitHub releases. This complements the existing create tools (repository, issue, pull request) and addresses a gap in the server's GitHub operations support.
Key changes:
- Added
CreateReleasetool with comprehensive parameter support (required: owner, repo, tag_name; optional: target_commitish, name, body, draft, prerelease, generate_release_notes) - Implemented proper error handling and response formatting following established patterns
- Added comprehensive test coverage with table-driven tests for success and error scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/github/tools.go | Registers the new CreateRelease tool in the default toolset |
| pkg/github/create_release.go | Implements the CreateRelease tool with parameter validation and GitHub API integration |
| pkg/github/create_release_test.go | Comprehensive test suite covering success cases and error handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Author
|
this release was created via Claude Code using this MCP as built from this branch
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR adds a new
CreateReleasetool to the GitHub MCP server, enabling users to create GitHub releases programmatically through the MCP interface.Motivation
As discussed in #1012, the GitHub MCP server currently supports reading release information but lacks the ability to create releases. This is a common need for CI/CD workflows and automation tasks. The addition of
CreateReleasecomplements the existingCreateRepository,CreateIssue, andCreatePullRequesttools, providing a more complete set of GitHub operations.Implementation
The implementation follows the established patterns in the codebase:
GetClientFnpattern as other toolsCreateRepositorymcp.NewToolResultErrorFeatures
The
CreateReleasetool supports:owner,repo,tag_nametarget_commitish: Branch or commit SHA for the releasename: Release namebody: Release descriptiondraft: Create as draft releaseprerelease: Mark as pre-releasegenerate_release_notes: Auto-generate release notes from commitsTesting
Added comprehensive test coverage including:
Checklist
Example Usage
{ "tool": "create_release", "parameters": { "owner": "octocat", "repo": "hello-world", "tag_name": "v1.0.0", "name": "Version 1.0.0", "body": "Initial release", "generate_release_notes": true } }